<?php


namespace app\manage\controller;


use app\api\model\Order as OrderModel;
use app\api\service\Token as TokenService;
use app\api\validate\Paginate;

class Order extends Base
{
    public function getSummary($page = 1, $size = 15)
    {
        (new Paginate())->goCheck();
        $uid = TokenService::getCurrentUID();
        $pager = OrderModel::getSimpleListByUser($uid, $page, $size);
        if ($pager->isEmpty()) {
            return [
                'data' => [],
                'current_page' => $pager->currentPage()
            ];
        }

        $data = $pager->hidden(['snap_items', 'snap_address', 'prepay_id'])->toArray();
        return [
            'data' => $data,
            'current_page' => $pager->currentPage()
        ];
    }

    public function index()
    {
        // TODO: Implement index() method.
    }

    public function create()
    {
        // TODO: Implement create() method.
    }

    public function detail($id)
    {
        // TODO: Implement detail() method.
    }

    public function edit($id)
    {
        // TODO: Implement edit() method.
    }

    public function delete($id)
    {
        // TODO: Implement delete() method.
    }
}